package com.datas.controller;

import com.datas.beans.ActResult;
import com.datas.db.hibernatebeans.UmsDepartment;
import com.datas.service.baseentity.DepartmentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by jige0727 on 2017/5/28.
 * 初始化
 */
@Controller
public class TestController {
    @Autowired
    DepartmentsService departmentsService;

    @ResponseBody
    @RequestMapping(value = "/test/dept", produces = "application/json;charset=UTF-8")
    public String dept() {
        UmsDepartment dept = new UmsDepartment();
        dept.setDept_name("测试1");
        dept.setDept_code("11112");
        dept.setParent_dept_id(22);
        dept.setParent_dept_name(null);
        dept.setStruct(null);
        dept.setMobilephone("111");
        dept.setEmail("222");
        dept.setTel("333");
        dept.setArea("444");
        dept.setProvince("555");
        dept.setCity("666");
        dept.setTown("777");
        Integer res = departmentsService.create(dept);
        return new ActResult(res, "成功", "错误").toJSONString();
    }

}
